<div class="header">
    <h1 class="page-title">管理员列表</h1>
</div>

<div class="well">
    <!-- search button -->
    <form action="" method="get" class="form-search">
        <div class="row-fluid" style="text-align: left;">
            <div class="pull-left span4 unstyled">
                <p> 用户名：<input class="input-medium" name="" type="text"></p>
            </div>
        </div>
        <button type="submit" class="btn">查找</button>
        <a class="btn btn-primary" href="/admin/managerAdd">新增</a>
    </form>
</div>
<div class="well">
    <!-- table -->
    <table class="table table-bordered table-hover table-condensed">
        <thead>
        <tr>
            <th>编号</th>
            <th>用户名</th>
            <th>昵称</th>
            <th>邮箱</th>
            <th>是否可用</th>
            <th>上次登录时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {foreach $data as $value}
        <tr class="success">
            <td>{$value['id']}</td>
            <td>{$value['username']}</td>
            <td>好吃的橙子</td>
            <td>{$value['email']}</td>
            <td>可用</td>
            <td>{:date('Y-m-d H:i:s',$value['last_login_time'])}</td>
            <td>
                <a href="/admin/managerEditor?id={$value['id']}"> 编辑 </a>
                <a href="javascript:void(0);" class="delete" data-id="{$value['id']}"> 删除 </a>
                <a href="javascript:void(0);"> 重置密码 </a>
            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    <!-- pagination -->
    <div class="pagination">
        {$data|raw}
    </div>
</div>
<!-- footer -->
<footer>
    <hr>
    <p>© 2017 <a href="javascript:void(0);" target="_blank">ADMIN</a></p>
</footer>
<script>
    $('.delete').click(function () {
        var id = $(this).attr('data-id');//自定义属性的值
        $.ajax({
            url:'/admin/managerDelete',
            type:'post',
            dataType:"json",
            data:{id:id},
            success:function (response) {
                alert(response.msg);
                if (response.code == 200) {
                    location.href = '/admin/managerList';
                }
            }
        })
    })
</script>